const jwt = require('jsonwebtoken');

const JWT_SECRET = 'H#KL9f$P2x!mB@vN5qR8sT3wY7zA4dC6gJ#nM';
const JWT_EXPIRES_IN = '1d';  // s m h d

module.exports = {
  JWT_SECRET,
  JWT_EXPIRES_IN,
  // 生成 JWT token
  generateToken: (payload) => {
    return jwt.sign(payload, JWT_SECRET, { expiresIn: JWT_EXPIRES_IN });
  },
  // 验证 JWT token
  verifyToken: (token) => {
    return jwt.verify(token, JWT_SECRET);
  }
};